<template>
  <div class="Coming">
    <div class="item-box" v-for="(item) in datas" :key="item.id" >
      <mvItem :data="item" title="预购" :id="item.id">
        <p slot="other">上映日期:{{item.mainland_pubdate|days()}}</p>
      </mvItem>
    </div>
  </div>
</template>
<script>
export default {
  mounted(){
    this.axios.get("https://douban.uieee.com/v2/movie/coming_soon").then(res=>{
     
      this.datas=res.data.subjects;
    })
  },
  data(){
    return{
      datas:[]
    }
  },
  filters:{
    days(value){
      var str=value.split("-");
      var days=str[0]+'年'+str[1]+'月'+str[2]+'日';
      var iWeekDay = -1;
      var y=parseInt(str[0]);
      var m=parseInt(str[1]);
      var d=parseInt(str[2]);
    iWeekDay = Math.floor((d+2*m+3*(m+1)/5+y+y/4-y/100+y/400)%7)

    // console.log(iWeekDay,str)
    switch(iWeekDay){
        case 0 : return "星期日 "+days; 
        case 1 : return "星期一 "+days; 
        case 2 : return "星期二 "+days; 
        case 3 : return "星期三 "+days; 
        case 4 : return "星期四 "+days; 
        case 5 : return "星期五 "+days;                                                       
        case 6 : return "星期六 "+days;
        default : return days+" 待定";
    }
    }
  }
}
</script>
<style scoped>

</style>